﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using trading_system.DataSet.DataSet1TableAdapters;


namespace trading_system
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Login1TableAdapter adapter = new Login1TableAdapter();
            var dataset = adapter.GetDataByUserName(UsrTextBox.Text);
            if (dataset.Count <= 0) 
            {
                //LabelError.Text = "User do no exit!";
                //LabelError.Visible=true;
               
            }
            else
            {
                var usr = dataset.Single();
                if (PswTextBox.Text.Equals(usr.PassWord))
                {
                    Session["Login"] = true;
                    Session["ID"] = usr.ID;
                    Response.Redirect("Welcome.htm");
                }
                else 
                {
                    //LabelError.Text = "wrong password!";
                    //LabelError.Visible = true;
                }
            }
        }
    }
}